/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fi.uba.algo3.tp3.modelo.inanimados;

import fi.uba.algo3.tp3.modelo.actores.Personaje;
import java.util.Collection;
import java.util.LinkedList;
import org.omg.PortableInterceptor.DISCARDING;

/**
 * @author ezequiel
 */
public abstract class ObstaculoFijo implements Obstaculo {

    protected Integer posX;
    protected Integer posY;

    protected Integer Ancho;
    protected Integer Alto;

    protected Collection<Obstaculo> obstaculos;

    public ObstaculoFijo(Integer posX, Integer posY) {
        this.posX = posX;
        this.posY = posY;
        obstaculos=new LinkedList<Obstaculo>();
    }

    @Override
    public int getX() {
        return posX;
    }

    @Override
    public int getY() {
        return posY;
    }

    public void setAncho(Integer Ancho) {
        this.Ancho = Ancho;
    }

    public void setAlto(Integer Alto) {
        this.Alto = Alto;
    }

    @Override
    public int getAlto() {
        return Alto;
    }

    @Override
    public int getAncho() {
        return Ancho;
    }

    public abstract void  generarObstaculos();

    public Collection<Obstaculo> obtenerObstaculos() {
        return obstaculos;
    }

    @Override
    public boolean hayColision(Personaje p) {
        if ((p.getX() < this.getX() + this.getAncho()) && (this.getX()< p.getX() + (p.getDistanciaDeColision()*2)) && (p.getY() < this.getY() + this.getAlto())) {
            return this.getY() < p.getY() + (p.getDistanciaDeColision()*2);
        }
        return false;
    }


}
